from datetime import datetime
from typing import Optional
from dataclasses import dataclass

@dataclass(frozen=True)
class Message:
    role: str
    content: str
    tool_call_id: Optional[str] = None
    name: Optional[str] = None

    def __post_init__(self):
        if not self.role or not self.content:
            raise ValueError("Role and content must be non-empty strings.")